package com.chinafree.business.controller;

import com.chinafree.business.model.result.BaseUserResult;
import com.chinafree.business.model.result.ChatResult;
import com.chinafree.business.model.result.CompanyResult;
import com.chinafree.business.service.ChatService;
import com.chinafree.common.model.request.ListPagingParam;
import com.chinafree.common.model.response.ListPagingResponse;
import com.chinafree.common.model.response.ListResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("chat")
public class ChatController extends BaseController{


    @Autowired
    private ChatService chatService;

    @PostMapping("/getCompany")
    public ListResponse<CompanyResult> getCompany(  ) {
        return chatService.getCompany();
    }

    @PostMapping("/getUser")
    public ListResponse<BaseUserResult> getUser() {
        return chatService.getUser();
    }

    @PostMapping("/getUserMessage")
    public ListResponse<ChatResult> getUserMessage(@RequestParam("id") Long uid) {
        return chatService.pullMsg(uid,getCompanyId());
    }
    @PostMapping("/getCompanyMessage")
    public ListResponse<ChatResult> getCompanyMessage( @RequestParam("id") Long uid ) {
       return chatService.pullMsg(getUserId(),uid);

    }

    

 


}

